package com.mall.sun.controller;

import com.mall.sun.model.dto.OrderDTO;
import com.mall.sun.model.dto.PageHelper;
import com.mall.sun.model.vo.ResultVO;
import com.mall.sun.service.OrdersService;
import com.mall.sun.utils.CommonUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * description:  <br>
 * date: 2021/12/8 18:34 <br>
 * author: ztz <br>
 * version: 1.0 <br>
 */
@RestController
@RequestMapping("/orders")
public class OrderController {
    @Autowired
    OrdersService ordersService;
    @PostMapping("/all")
    public ResultVO GetAllOrders(@RequestBody PageHelper pageHelper){
        return CommonUtil.ajaxReturn(ordersService.getAllOrders(pageHelper));
    }
    @PutMapping("/update")
    public ResultVO UpdateOrder(@RequestBody OrderDTO orderDTO){
        return CommonUtil.ajaxReturn(ordersService.updateOrder(orderDTO));
    }
}
